/* webpack.client.js */
const path = require('path');
const webpack = require('webpack');
const projectRoot = path.resolve(__dirname, '..');


module.exports = {
      entry: ['babel-polyfill', path.join(projectRoot, 'src/entry-client.js')],
      output: {
            path: path.join(projectRoot, 'dist'),
            filename: 'bundle.client.js',
      },
      module: {
            rules: [{
                  test: /\.vue$/,
                  loader: 'vue-loader'
            },
            {
                  test: /\.js$/,
                  loader: 'babel-loader',
                  include: projectRoot,
                  exclude: /node_modules/,
                  options: {
                        presets: ['es2015']
                  }
            }
            ]
      },
      plugins: [
            new webpack.DefinePlugin({
                  'process.env.VUE_ENV': '"client"' // 增加process.env.VUE_ENV
            })
      ],
      resolve: {
            alias: {
                  'vue$': 'vue/dist/vue.runtime.esm.js'
            }
      }
};